﻿Public Class HomePage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Request.Params("UserName") = User.Identity.Name Then
            btn_addArticle.Visible = False
            btn_addPicture.Visible = False
        Else
            btn_msg.Visible = False
        End If

        If Request.Params("UserName") = "" Then
            Response.Redirect("Homepage.aspx?UserName=" & User.Identity.Name)
        End If
    End Sub

    Protected Function getDate(ByVal dateTime As String) As String
        If (dateTime = "") Then
            Return "UNKONWN"
        Else
            Dim parts As String() = dateTime.Split(" ")
            Return parts(0)
        End If
    End Function

    Protected Sub btn_addArticle_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_addArticle.Click
        Response.Redirect("addArticle.aspx?UserName=" & User.Identity.Name)
    End Sub

    Protected Sub btn_addPicture_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_addPicture.Click
        Response.Redirect("addPicture.aspx?UserName=" & User.Identity.Name)
    End Sub

    Protected Sub btn_msg_Click(sender As Object, e As EventArgs) Handles btn_msg.Click
        Response.Redirect("addMessage.aspx?UserName=" & Request.Params("UserName"))
    End Sub
End Class